package com.hongning.railway.ui.main.cadremanager;

import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.hongning.railway.BR;
import com.hongning.railway.R;
import com.hongning.railway.app.AppViewModelFactory;
import com.hongning.railway.databinding.FragmentCadremanagerBinding;

import me.goldze.mvvmhabit.base.BaseFragment;

/**
 * Author: zhangjing
 * DATA:2019-08-29 10:51
 * DESC:干部管理列表页面
 * email:zhangjingworkmol@163.com
 */
public class CadreManagerFragment extends BaseFragment<FragmentCadremanagerBinding,CadreManagerFragmentViewModel> {
    public static CadreManagerFragment newInstance() {
        
        Bundle args = new Bundle();
        
        CadreManagerFragment fragment = new CadreManagerFragment();
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_cadremanager;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        binding.appTitle.tvTopTitle.setText("干部测评");
        binding.trRefhreh.setEnableLoadmore(false);
        binding.trRefhreh.setEnableRefresh(false);
        binding.appTitle.ivLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
        viewModel.loadData();
    }

    @Override
    public CadreManagerFragmentViewModel initViewModel() {
        AppViewModelFactory appViewModelFactory = AppViewModelFactory.getInstance(getActivity().getApplication());
        return ViewModelProviders.of(this,appViewModelFactory).get(CadreManagerFragmentViewModel.class);
    }
}
